/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package render;

import java.util.List;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListModel;
import utils.Reflection;

/**
 *
 * @author Canh
 */
public class CTCComboboxModel extends DefaultComboBoxModel<Object> {

    List data;

    public List getData() {
        return data;
    }

    public void setData(List data) {
        this.data = data;
        realoadData();
    }

    public String getShowMethod() {
        return showMethod;
    }

    public void setShowMethod(String showMethod) {
        this.showMethod = showMethod;
        realoadData();
    }
    String showMethod;

    public CTCComboboxModel(List data, String showMethod) {
        this.data = data;
        this.showMethod = showMethod;
        realoadData();
    }

    void realoadData() {
        this.removeAllElements();
        for (int i = 0; i < data.size(); i++) {
            this.addElement(Reflection.readMethodValue(data.get(i), showMethod));
        }
    }

}
